home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
util
/
text
/
quilldem.lha
/
Demo
/
Rexx
/
CmdShell.quill
next >
Wrap
Text File
|
1995-08-29
|
3KB
|
102 lines
/**
** $VER: CmdShell.quill 1.1 (27.9.94)
**
** CmdShell.quill - Command shell for Digital Quill
** Make sure this file is in your REXX: directory and that it is
** called "CmdShell.quill" (without the quotes) otherwise the editor
** will NOT be able to start the command shell!
**
** This macro implements the command line shell for the editor. This
** is a command-line interface for Digital Quill, a means of entering
** editor commands from the keyboard. This is implemented through
** ARexx to obtain maximum power and flexibility. Everything you
** enter in the command shell window is actual a line of ARexx code,
** so all ARexx commands, functions, and contructs are available to
** you, in addition to the host of editor specific commands.
**
**/
/* Some setup first.
*/
options results
options failat 100
prompt = address()'> '
/* Get the rexxsupport.library.
*/
if ~show(l, "rexxsupport.library") then
if ~addlib("rexxsupport.library", 0, -30) then
exit
/* Here's where the actual macro begins.
*/
main:
/* Open the output window.
*/
'GETATTR' 'WINDOW STEM' window_attrs
'GETATTR' 'APPLICATION SCREEN VAR' screenname
winleft = window_attrs.borderleft + window_attrs.left
winwidth = 500
winheight = 80
wintop = window_attrs.top + window_attrs.bordertop
window_parm = 'CON:'winleft'/'wintop'/'winwidth'/'winheight'/Command Shell/CLOSE/AUTO/SCREEN'||screenname''
if open('window_fh', window_parm, 'R') then do
/* Loop around continuously getting input from the user. This works
* very similarly to a standard AmigaDOS shell, users type in commands
* followed by <Return>. Basically, we'll just pass whatever is
* entered onto ARexx, except for some special case commands for help,
* changing the command prompt, and exiting the shell.
*/
do forever
/* Prompt.
*/
call writech('window_fh', prompt)
/* Wait until the user types a command followed by RETURN
*/
cmd = readln('window_fh')
select
when (cmd = "") | (upper(cmd) = "ENDSHELL") then
leave
when (cmd = "?") | (upper(cmd) = "HELP") then do
call writeln('window_fh', 'Enter "HELP <command>" to obtain a command''s template.')
call writeln('window_fh', 'Press <Ctrl>\ or enter "ENDSHELL" to close the shell.')
end
otherwise call handle_cmd(cmd)
end
end
call writeln('window_fh', 'Done.')
end
return
/* Handle the command entered by the user.
*/
handle_cmd: procedure
parse arg cmd
/* Execute the command through ARexx itself.
*/
interpret cmd
/* See if the command succeeded and display and result string.
*/
if rc = 0 then do
if symbol('RESULT') == "VAR" then do
call writeln('window_fh', result)
end
return
end
return